<!DOCTYPE HTML>
<html lang="zh-CN">






<head>
    <!--让百度解析-->
    <meta name="baidu-site-verification" content="code-BwRMg6yW1H" />

    <meta charset="utf-8">


    <meta name="keywords" content="javascript小知识点, keys">
    <meta name="description" content="站长很懒，什么都没有留下....">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>javascript小知识点 | 张小菜</title>
    <link rel="icon" type="image/gif" style="width: 100%;height: 100%;" href="/../../images/logoOne.gif">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery.min.js"></script>

    <!--雪花飘落代码块-->
    

    <!--樱花飘落代码块-->
    

    <!--点击显示文字效果-->
    
        <script type="text/javascript">
          //只在桌面版网页启用特效
          var windowWidth = $(window).width();
          if (windowWidth > 768) {
            document.write('<script type="text/javascript" src="/js/wenzi.js"><\/script>');
        }
    </script>
    


<meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="张小菜" type="application/atom+xml">
<link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css"></head>



   <style>
    body{
       background-image: url('/medias/background.jpg');
       background-repeat:no-repeat;
       background-size:cover;
       background-attachment:fixed;
    }
</style>




<body>
    <header class="navbar-fixed">
    <script>
        /*这段代码用于百度统计植入代码*/
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?851ba41937b8a3d4d644c8216f055c91";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>

    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/../../images/logoOne.gif" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">张小菜</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
    
        <li class="hide-on-med-and-down nav-item">
            
                <a href="/" class="waves-effect waves-light">
                    
                        <i class="fas fa-home" style="zoom: 0.6;"></i>
                    
                    <span>首页</span>
                </a>
            
        </li>
    
        <li class="hide-on-med-and-down nav-item">
            
                <a href="/tags" class="waves-effect waves-light">
                    
                        <i class="fas fa-tags" style="zoom: 0.6;"></i>
                    
                    <span>标签</span>
                </a>
            
        </li>
    
        <li class="hide-on-med-and-down nav-item">
            
                <a href="/categories" class="waves-effect waves-light">
                    
                        <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
                    
                    <span>分类</span>
                </a>
            
        </li>
    
        <li class="hide-on-med-and-down nav-item">
            
                <a href="/archives" class="waves-effect waves-light">
                    
                        <i class="fas fa-archive" style="zoom: 0.6;"></i>
                    
                    <span>归档</span>
                </a>
            
        </li>
    
        <li class="hide-on-med-and-down nav-item">
            
                <a href="/about" class="waves-effect waves-light">
                    
                        <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
                    
                    <span>关于</span>
                </a>
            
        </li>
    
        <li class="hide-on-med-and-down nav-item">
            
                <a target="_blank" rel="noopener" href="https://www.zdzn.net/" class="waves-effect waves-light">
                    
                        <i class="fas fa-comments" style="zoom: 0.6;"></i>
                    
                    <span>聚宝盒</span>
                </a>
            
        </li>
    
        <li class="hide-on-med-and-down nav-item">
            
                <a href="" class="waves-effect waves-light">

                    
                        <i class="fa fa-heartbeat" style="zoom: 0.6;"></i>
                    
                    <span>功能</span>
                    <i class="fas fa-chevron-down" aria-hidden="true" style="zoom: 0.6;"></i>
                </a>
                <ul class="sub-nav menus_item_child ">
                    
                        <li>
                            <a target="_blank" rel="noopener" href="http://43.138.208.196:8080/examsSystem/index.jsp">
                                
                                    <i class="fab fa-codepen" style="margin-top: -20px; zoom: 0.6;"></i>
                                
                                <span>考试系统</span>
                            </a>
                        </li>
                    
                        <li>
                            <a target="_blank" rel="noopener" href="http://43.138.208.196/page/login.html">
                                
                                    <i class="fab fa-dev" style="margin-top: -20px; zoom: 0.6;"></i>
                                
                                <span>shell-web</span>
                            </a>
                        </li>
                    
                        <li>
                            <a target="_blank" rel="noopener" href="http://43.138.208.196:8081/html/Login.html">
                                
                                    <i class="fab fa-artstation" style="margin-top: -20px; zoom: 0.6;"></i>
                                
                                <span>基金系统</span>
                            </a>
                        </li>
                    
                        <li>
                            <a href="http://zhangxiaocainb.gitee.io/music-player">
                                
                                    <i class="fa fa-music" style="margin-top: -20px; zoom: 0.6;"></i>
                                
                                <span>我的音乐</span>
                            </a>
                        </li>
                    
                </ul>
            
        </li>
    
    <li>
        <a href="#searchModal" class="modal-trigger waves-effect waves-light">
            <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
        </a>
    </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/../../images/logoOne.gif" class="logo-img circle responsive-img">
        
        <div class="logo-name">张小菜</div>
        <div class="logo-desc">
            
            站长很懒，什么都没有留下....
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a target="_blank" rel="noopener" href="https://www.zdzn.net/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="javascript:;">
			
				<i class="fa-fw fa fa-heartbeat"></i>
			
			Functions
			<span class="m-icon"><i class="fas fa-chevron-right"></i></span>
		</a>
            <ul  style="background:  ;" >
              
                <li>

                  <a target="_blank" rel="noopener" href="http://43.138.208.196:8080/examsSystem/index.jsp " style="margin-left:75px">
				  
				   <i class="fa fab fa-codepen" style="position: absolute;left:50px" ></i>
			      
		          <span>考试系统</span>
                  </a>
                </li>
              
                <li>

                  <a target="_blank" rel="noopener" href="http://43.138.208.196/page/login.html " style="margin-left:75px">
				  
				   <i class="fa fab fa-dev" style="position: absolute;left:50px" ></i>
			      
		          <span>shell-web</span>
                  </a>
                </li>
              
                <li>

                  <a target="_blank" rel="noopener" href="http://43.138.208.196:8081/html/Login.html " style="margin-left:75px">
				  
				   <i class="fa fab fa-artstation" style="position: absolute;left:50px" ></i>
			      
		          <span>基金系统</span>
                  </a>
                </li>
              
                <li>

                  <a href="http://zhangxiaocainb.gitee.io/music-player " style="margin-left:75px">
				  
				   <i class="fa fa fa-music" style="position: absolute;left:50px" ></i>
			      
		          <span>我的音乐</span>
                  </a>
                </li>
              
            </ul>
          
        </li>
        
        
    </ul>
</div>


        </div>

        
    </nav>

</header>

    
<script src="/libs/cryptojs/crypto-js.min.js"></script>
<script>
    (function() {
        let pwd = '';
        if (pwd && pwd.length > 0) {
            if (pwd !== CryptoJS.SHA256(prompt('该文章需要密码才能访问哦！')).toString(CryptoJS.enc.Hex)) {
                alert('密码错误，将返回主页！');
                location.href = '/';
            }
        }
    })();
</script>




<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/2.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">javascript小知识点</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        padding: 35px 0 15px 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        padding-bottom: 30px;
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/javascript/">
                                <span class="chip bg-color">javascript</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/%E5%89%8D%E7%AB%AF/" class="post-category">
                                前端
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2021-08-31
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2021-09-01
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    1.6k
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-clock fa-fw"></i>预计阅读时长:&nbsp;&nbsp;
                    5 分
                </div>
                

                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>
        </div>
        <hr class="clearfix">

        

        

        <div class="card-content article-card-content">
            <div id="articleContent">
                <h2 id="目录一"><a href="#目录一" class="headerlink" title="目录一"></a>目录一</h2><h3 id="一、js关系运算符比较时表达式转换问题"><a href="#一、js关系运算符比较时表达式转换问题" class="headerlink" title="一、js关系运算符比较时表达式转换问题"></a>一、js关系运算符比较时表达式转换问题</h3><p>1、纯字符比较转换成ascll值在进行比较，从第一位开始比较，如果分出高低，后面的则不进行比较。<br>2、纯数字和纯数字字符串相比较，则将字符串数字隐式转换成数字再进行比较。<br>3、纯数字和非“纯”数字字符串或非数字字符串比较，都返回false<br>4、纯数字和布尔值进行比较，将布尔值转换成数字比较，true=1；false=0；<br>5、布尔值和字符串进行比较的话，会将布尔值转换成数字再和字符串进行比较。<br>总结：凡是有一方是数字或可以转换为数字(如果两方都是纯数字字符串，不转换)，则肯定会用数字进行这局比较。</p>
<h3 id="二、数据的强制转换和调用方法转换"><a href="#二、数据的强制转换和调用方法转换" class="headerlink" title="二、数据的强制转换和调用方法转换"></a>二、数据的强制转换和调用方法转换</h3><p>parseInt()需要进行类型判断,如果判断不出类型则出错，往后所有的自动转换计算机都会选择强制转换。</p>
<h3 id="三、蛙课"><a href="#三、蛙课" class="headerlink" title="三、蛙课"></a>三、<a target="_blank" rel="noopener" href="https://www.wkcto.com/">蛙课</a></h3><h3 id="四、需要折线图或者统计图可以搜索echart最大的曲线图站，可以通过highcharts菜鸟网站学习。"><a href="#四、需要折线图或者统计图可以搜索echart最大的曲线图站，可以通过highcharts菜鸟网站学习。" class="headerlink" title="四、需要折线图或者统计图可以搜索echart最大的曲线图站，可以通过highcharts菜鸟网站学习。"></a>四、需要折线图或者统计图可以搜索echart最大的曲线图站，可以通过highcharts菜鸟网站学习。</h3><h3 id="五、万维网站"><a href="#五、万维网站" class="headerlink" title="五、万维网站"></a>五、<a target="_blank" rel="noopener" href="https://www.w3school.com.cn/">万维网站</a></h3><h3 id="六、通过元素修改样式或获得样式方法分为两种"><a href="#六、通过元素修改样式或获得样式方法分为两种" class="headerlink" title="六、通过元素修改样式或获得样式方法分为两种"></a>六、通过元素修改样式或获得样式方法分为两种</h3><p>可以修改：var idss=document.getElementById(“ids”);idss.style.width=numWidth+50+”px”;<br>可以得到并查看：var ids=getComputedStyle(document.getElementById(“ids”),false);</p>
<h3 id="七、javascript学习网站"><a href="#七、javascript学习网站" class="headerlink" title="七、javascript学习网站"></a>七、<a target="_blank" rel="noopener" href="https://www.runoob.com/">javascript学习网站</a></h3><h3 id="八、class样式不能用数字当名字"><a href="#八、class样式不能用数字当名字" class="headerlink" title="八、class样式不能用数字当名字"></a>八、class样式不能用数字当名字</h3><h3 id="九、使标签回变为不可用状态disabled-”disabled”，变为可用状态设为空字符串即可"><a href="#九、使标签回变为不可用状态disabled-”disabled”，变为可用状态设为空字符串即可" class="headerlink" title="九、使标签回变为不可用状态disabled=”disabled”，变为可用状态设为空字符串即可"></a>九、使标签回变为不可用状态disabled=”disabled”，变为可用状态设为空字符串即可</h3><h3 id="十、元素调用直接focus-方法"><a href="#十、元素调用直接focus-方法" class="headerlink" title="十、元素调用直接focus()方法"></a>十、元素调用直接focus()方法</h3><p>自动触动获得焦点事件，也就是不用点也为失去焦点，在注册提交是用到。</p>
<h2 id="目录二"><a href="#目录二" class="headerlink" title="目录二"></a>目录二</h2><h3 id="十一、form有一个submit-方法，调用即执行提交，因为在注册提交的时候用submit的话没有办法做判断后，它会直接提交，所以我们一般会用button进行提交，再调用form的submit-方法"><a href="#十一、form有一个submit-方法，调用即执行提交，因为在注册提交的时候用submit的话没有办法做判断后，它会直接提交，所以我们一般会用button进行提交，再调用form的submit-方法" class="headerlink" title="十一、form有一个submit()方法，调用即执行提交，因为在注册提交的时候用submit的话没有办法做判断后，它会直接提交，所以我们一般会用button进行提交，再调用form的submit()方法"></a>十一、form有一个submit()方法，调用即执行提交，因为在注册提交的时候用submit的话没有办法做判断后，它会直接提交，所以我们一般会用button进行提交，再调用form的submit()方法</h3><h3 id="十二、innerHTML和value使用时的区别？"><a href="#十二、innerHTML和value使用时的区别？" class="headerlink" title="十二、innerHTML和value使用时的区别？"></a>十二、innerHTML和value使用时的区别？</h3><pre class=" language-java"><code class="language-java">innerHTML常用于修改和获得非闭合标签<span class="token punctuation">(</span><span class="token operator">&lt;</span>p<span class="token operator">></span><span class="token operator">&lt;</span><span class="token operator">/</span>p<span class="token operator">></span><span class="token punctuation">,</span><span class="token operator">&lt;</span>a<span class="token operator">></span><span class="token operator">&lt;</span>a<span class="token operator">></span>等<span class="token punctuation">)</span>元素的内容。
value常用于修改和获得闭合标签<span class="token punctuation">(</span><span class="token operator">&lt;</span>input<span class="token operator">/</span><span class="token operator">></span><span class="token punctuation">,</span><span class="token operator">&lt;</span>br<span class="token operator">/</span><span class="token operator">></span>等<span class="token punctuation">)</span>元素类容
</code></pre>
<h3 id="十三、iframe标签中添加src属性会直接加载src路径所指向的文档"><a href="#十三、iframe标签中添加src属性会直接加载src路径所指向的文档" class="headerlink" title="十三、iframe标签中添加src属性会直接加载src路径所指向的文档"></a>十三、iframe标签中添加src属性会直接加载src路径所指向的文档</h3><h3 id="十四、下拉列表框select可以通过select元素对象调用options直接获得option节点集合，options-select对象-selectedIndex-来获得指定选择的option元素"><a href="#十四、下拉列表框select可以通过select元素对象调用options直接获得option节点集合，options-select对象-selectedIndex-来获得指定选择的option元素" class="headerlink" title="十四、下拉列表框select可以通过select元素对象调用options直接获得option节点集合，options[select对象.selectedIndex]来获得指定选择的option元素"></a>十四、下拉列表框select可以通过select元素对象调用options直接获得option节点集合，options[select对象.selectedIndex]来获得指定选择的option元素</h3><h2 id="目录三"><a href="#目录三" class="headerlink" title="目录三"></a>目录三</h2><h3 id="十五、XMLHttpRequest对象的open-“get”-”url”-false-true-方法最后一个参数如果为true则代表异步-不管你这个对象发送请求或者接受响应与否，都会进行下一步运行，那么如果在没有接收到响应数据之前使用该对象调用客户端数据则会报错-，如果将其设置为false那么就是同步。"><a href="#十五、XMLHttpRequest对象的open-“get”-”url”-false-true-方法最后一个参数如果为true则代表异步-不管你这个对象发送请求或者接受响应与否，都会进行下一步运行，那么如果在没有接收到响应数据之前使用该对象调用客户端数据则会报错-，如果将其设置为false那么就是同步。" class="headerlink" title="十五、XMLHttpRequest对象的open(“get”,”url”,false/true)方法最后一个参数如果为true则代表异步(不管你这个对象发送请求或者接受响应与否，都会进行下一步运行，那么如果在没有接收到响应数据之前使用该对象调用客户端数据则会报错)，如果将其设置为false那么就是同步。"></a>十五、XMLHttpRequest对象的open(“get”,”url”,false/true)方法最后一个参数如果为true则代表异步(不管你这个对象发送请求或者接受响应与否，都会进行下一步运行，那么如果在没有接收到响应数据之前使用该对象调用客户端数据则会报错)，如果将其设置为false那么就是同步。</h3><h3 id="十六、如果获取了元素对象，想要知道元素名的话可以通过对象调用nodeName方法获取"><a href="#十六、如果获取了元素对象，想要知道元素名的话可以通过对象调用nodeName方法获取" class="headerlink" title="十六、如果获取了元素对象，想要知道元素名的话可以通过对象调用nodeName方法获取"></a>十六、如果获取了元素对象，想要知道元素名的话可以通过对象调用nodeName方法获取</h3><h3 id="十七、节点拿到字节点集合的方式有两种，又时某一种会失效，那么就选择另一种："><a href="#十七、节点拿到字节点集合的方式有两种，又时某一种会失效，那么就选择另一种：" class="headerlink" title="十七、节点拿到字节点集合的方式有两种，又时某一种会失效，那么就选择另一种："></a>十七、节点拿到字节点集合的方式有两种，又时某一种会失效，那么就选择另一种：</h3><p>对象.childNodes;<br>对象.childred;</p>
<h3 id="十八、jQuery中html-和text-的区别：text会返回带标签的内容，也就是不会解析html，会将html标签当作字符串返回，html只返回元素开闭标签之间的内容，会解析html元素"><a href="#十八、jQuery中html-和text-的区别：text会返回带标签的内容，也就是不会解析html，会将html标签当作字符串返回，html只返回元素开闭标签之间的内容，会解析html元素" class="headerlink" title="十八、jQuery中html()和text()的区别：text会返回带标签的内容，也就是不会解析html，会将html标签当作字符串返回，html只返回元素开闭标签之间的内容，会解析html元素"></a>十八、jQuery中html()和text()的区别：text会返回带标签的内容，也就是不会解析html，会将html标签当作字符串返回，html只返回元素开闭标签之间的内容，会解析html元素</h3><h3 id="十九、jQuery中拿到用户输入input-text中的值的方法：val"><a href="#十九、jQuery中拿到用户输入input-text中的值的方法：val" class="headerlink" title="十九、jQuery中拿到用户输入input text中的值的方法：val();"></a>十九、jQuery中拿到用户输入input text中的值的方法：val();</h3><h2 id="目录四"><a href="#目录四" class="headerlink" title="目录四"></a>目录四</h2><h3 id="二十、jQuery中闭合标签"><a href="#二十、jQuery中闭合标签" class="headerlink" title="二十、jQuery中闭合标签"></a>二十、jQuery中闭合标签</h3><pre class=" language-js"><code class="language-js"><span class="token punctuation">(</span>如<span class="token operator">&lt;</span>input<span class="token operator">/</span><span class="token operator">></span><span class="token operator">&lt;</span>br<span class="token operator">/</span><span class="token operator">></span><span class="token punctuation">)</span><span class="token function">如果需要取得其中的值，要用到val</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token function">方法，非闭合标签</span><span class="token punctuation">(</span>如<span class="token operator">&lt;</span>a<span class="token operator">></span><span class="token operator">&lt;</span>a<span class="token operator">/</span><span class="token operator">></span><span class="token punctuation">)</span><span class="token function">如果要取得其中的值，需要用到text</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token function">或者html</span><span class="token punctuation">(</span><span class="token punctuation">)</span>方法
</code></pre>
<h3 id="二十一、jQuery中有两种遍历方法，分别讲它们的遍历场合和用法"><a href="#二十一、jQuery中有两种遍历方法，分别讲它们的遍历场合和用法" class="headerlink" title="二十一、jQuery中有两种遍历方法，分别讲它们的遍历场合和用法"></a>二十一、jQuery中有两种遍历方法，分别讲它们的遍历场合和用法</h3><p>$.each(元素，function(index,item){});拿到元素并且赋值给变量时适用。两个参数，第一个参数表示遍历的数组的下标，第二个参数表示下标对应的值，一般下标不使用，item直接就属于一个元素。<br>$(选择器).each(function(index,item){});拿元素的同时使用。两个参数，第一个参数表示遍历的数组的下标，第二个参数表示下标对应的值，一般下标不使用，item直接就属于一个元素。</p>
<h3 id="二十二、jQuery做遍历时this或者item都需要加-因为浏览器无法判定是否为jQuery方法。"><a href="#二十二、jQuery做遍历时this或者item都需要加-因为浏览器无法判定是否为jQuery方法。" class="headerlink" title="二十二、jQuery做遍历时this或者item都需要加$,因为浏览器无法判定是否为jQuery方法。"></a>二十二、jQuery做遍历时this或者item都需要加$,因为浏览器无法判定是否为jQuery方法。</h3><h3 id="二十三、元素-window-event-srcElement，js原生方法，表示事件源方法，元素正在执行事件则判断为true。"><a href="#二十三、元素-window-event-srcElement，js原生方法，表示事件源方法，元素正在执行事件则判断为true。" class="headerlink" title="二十三、元素==window.event.srcElement，js原生方法，表示事件源方法，元素正在执行事件则判断为true。"></a>二十三、元素==window.event.srcElement，js原生方法，表示事件源方法，元素正在执行事件则判断为true。</h3><h3 id="二十四、JQuery设置属性的方法是attr-具体参考javascript参考文档。"><a href="#二十四、JQuery设置属性的方法是attr-具体参考javascript参考文档。" class="headerlink" title="二十四、JQuery设置属性的方法是attr(),具体参考javascript参考文档。"></a>二十四、JQuery设置属性的方法是attr(),具体参考javascript参考文档。</h3><h2 id="目录五"><a href="#目录五" class="headerlink" title="目录五"></a>目录五</h2><h3 id="二十五、关于dom对象和js对象的装换"><a href="#二十五、关于dom对象和js对象的装换" class="headerlink" title="二十五、关于dom对象和js对象的装换"></a>二十五、关于dom对象和js对象的装换</h3><p>dom–&gt;js:$(dom对象)<br>js–&gt;dom:(js对象)[0]</p>
<h3 id="二十六、在web文件下直接建立文件，该文件下创建jsp发送ajax，ajax不能直接写路径，要-跳出该文件后才能写路径，所有一般路径为-XXX-servlet"><a href="#二十六、在web文件下直接建立文件，该文件下创建jsp发送ajax，ajax不能直接写路径，要-跳出该文件后才能写路径，所有一般路径为-XXX-servlet" class="headerlink" title="二十六、在web文件下直接建立文件，该文件下创建jsp发送ajax，ajax不能直接写路径，要../跳出该文件后才能写路径，所有一般路径为../XXX.servlet"></a>二十六、在web文件下直接建立文件，该文件下创建jsp发送ajax，ajax不能直接写路径，要../跳出该文件后才能写路径，所有一般路径为../XXX.servlet</h3><h3 id="二十七、在js文件中不能直接使用el表达式以及java代码（浏览器是识别不了jsp中el等标签的：返回给客户端的结果是JSP文件执行的结果，不包含任何JSP语法）。但是el表达式、java代码、js脚本、jstl标签等都可以在jsp文件中使用，所以要想在js代码中使用el表达式的值或者是java代码的值，可以通过jsp文件这样一个桥梁，达到目的！"><a href="#二十七、在js文件中不能直接使用el表达式以及java代码（浏览器是识别不了jsp中el等标签的：返回给客户端的结果是JSP文件执行的结果，不包含任何JSP语法）。但是el表达式、java代码、js脚本、jstl标签等都可以在jsp文件中使用，所以要想在js代码中使用el表达式的值或者是java代码的值，可以通过jsp文件这样一个桥梁，达到目的！" class="headerlink" title="二十七、在js文件中不能直接使用el表达式以及java代码（浏览器是识别不了jsp中el等标签的：返回给客户端的结果是JSP文件执行的结果，不包含任何JSP语法）。但是el表达式、java代码、js脚本、jstl标签等都可以在jsp文件中使用，所以要想在js代码中使用el表达式的值或者是java代码的值，可以通过jsp文件这样一个桥梁，达到目的！"></a>二十七、在js文件中不能直接使用el表达式以及java代码（浏览器是识别不了jsp中el等标签的：返回给客户端的结果是JSP文件执行的结果，不包含任何JSP语法）。但是el表达式、java代码、js脚本、jstl标签等都可以在jsp文件中使用，所以要想在js代码中使用el表达式的值或者是java代码的值，可以通过jsp文件这样一个桥梁，达到目的！</h3><p>js写在jsp文件里，jsp能用的标签（el表达式、jstl标签、java代码等），js就能“用”；js单独写成一个文件，啥标签都不能“用”，都没效。不过一般不建议js使用乱七八糟的jsp标签。 </p>
<h2 id="目录六"><a href="#目录六" class="headerlink" title="目录六"></a>目录六</h2><h3 id="二十八、动态生成元素注意点，动态添加的元素要通过在动态生成的元素上添加class属性，如何通过class选择器拿到-用于需要取得动态生成的多个元素时使用-。如"><a href="#二十八、动态生成元素注意点，动态添加的元素要通过在动态生成的元素上添加class属性，如何通过class选择器拿到-用于需要取得动态生成的多个元素时使用-。如" class="headerlink" title="二十八、动态生成元素注意点，动态添加的元素要通过在动态生成的元素上添加class属性，如何通过class选择器拿到(用于需要取得动态生成的多个元素时使用)。如:"></a>二十八、动态生成元素注意点，动态添加的元素要通过在动态生成的元素上添加class属性，如何通过class选择器拿到(用于需要取得动态生成的多个元素时使用)。如:</h3><pre class=" language-js"><code class="language-js"><span class="token function">$</span><span class="token punctuation">(</span><span class="token string">".delete"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">each</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    <span class="token function">$</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">click</span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
         <span class="token function">alert</span><span class="token punctuation">(</span><span class="token function">$</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">attr</span><span class="token punctuation">(</span><span class="token string">"name"</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
     <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h3 id="二十九、select-option下拉框如何获得属性value的值，元素-val-即可；"><a href="#二十九、select-option下拉框如何获得属性value的值，元素-val-即可；" class="headerlink" title="二十九、select option下拉框如何获得属性value的值，元素.val()即可；"></a>二十九、select option下拉框如何获得属性value的值，元素.val()即可；</h3><h3 id="三十、但凡在网页页面导入jQuery包"><a href="#三十、但凡在网页页面导入jQuery包" class="headerlink" title="三十、但凡在网页页面导入jQuery包"></a>三十、但凡在网页页面导入jQuery包</h3><pre class=" language-js"><code class="language-js">只要用到<span class="token operator">&lt;</span>script<span class="token operator">></span><span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">></span>标签，一定要<span class="token operator">&lt;</span>script src<span class="token operator">=</span><span class="token string">"路径"</span><span class="token operator">></span><span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">></span>，如果<span class="token operator">&lt;</span>script src<span class="token operator">=</span><span class="token string">"路径"</span><span class="token operator">/</span><span class="token operator">></span>则报错；
</code></pre>

                
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/about" rel="external nofollow noreferrer">张小菜</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://zhangxiaocainb.gitee.io/2021/08/31/js/javascript/">https://zhangxiaocainb.gitee.io/2021/08/31/js/javascript/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/about" target="_blank">张小菜</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/javascript/">
                                    <span class="chip bg-color">javascript</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/medias/reward/wechat.jpg" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>

            
        </div>
    </div>

    

    

    

    

    
        <style>
    .valine-card {
        margin: 1.5rem auto;
    }

    .valine-card .card-content {
        padding: 20px 20px 5px 20px;
    }

    #vcomments textarea {
        box-sizing: border-box;
        background: url("/medias/hmbbverymin.png") 100% 100% no-repeat;
    }

    #vcomments p {
        margin: 2px 2px 10px;
        font-size: 1.05rem;
        line-height: 1.78rem;
    }

    #vcomments blockquote p {
        text-indent: 0.2rem;
    }

    #vcomments a {
        padding: 0 2px;
        color: #4cbf30;
        font-weight: 500;
        text-decoration: none;
    }

    #vcomments img {
        max-width: 100%;
        height: auto;
        cursor: pointer;
    }

    #vcomments ol li {
        list-style-type: decimal;
    }

    #vcomments ol,
    ul {
        display: block;
        padding-left: 2em;
        word-spacing: 0.05rem;
    }

    #vcomments ul li,
    ol li {
        display: list-item;
        line-height: 1.8rem;
        font-size: 1rem;
    }

    #vcomments ul li {
        list-style-type: disc;
    }

    #vcomments ul ul li {
        list-style-type: circle;
    }

    #vcomments table, th, td {
        padding: 12px 13px;
        border: 1px solid #dfe2e5;
    }

    #vcomments table, th, td {
        border: 0;
    }

    table tr:nth-child(2n), thead {
        background-color: #fafafa;
    }

    #vcomments table th {
        background-color: #f2f2f2;
        min-width: 80px;
    }

    #vcomments table td {
        min-width: 80px;
    }

    #vcomments h1 {
        font-size: 1.85rem;
        font-weight: bold;
        line-height: 2.2rem;
    }

    #vcomments h2 {
        font-size: 1.65rem;
        font-weight: bold;
        line-height: 1.9rem;
    }

    #vcomments h3 {
        font-size: 1.45rem;
        font-weight: bold;
        line-height: 1.7rem;
    }

    #vcomments h4 {
        font-size: 1.25rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    #vcomments h5 {
        font-size: 1.1rem;
        font-weight: bold;
        line-height: 1.4rem;
    }

    #vcomments h6 {
        font-size: 1rem;
        line-height: 1.3rem;
    }

    #vcomments p {
        font-size: 1rem;
        line-height: 1.5rem;
    }

    #vcomments hr {
        margin: 12px 0;
        border: 0;
        border-top: 1px solid #ccc;
    }

    #vcomments blockquote {
        margin: 15px 0;
        border-left: 5px solid #42b983;
        padding: 1rem 0.8rem 0.3rem 0.8rem;
        color: #666;
        background-color: rgba(66, 185, 131, .1);
    }

    #vcomments pre {
        font-family: monospace, monospace;
        padding: 1.2em;
        margin: .5em 0;
        background: #272822;
        overflow: auto;
        border-radius: 0.3em;
        tab-size: 4;
    }

    #vcomments code {
        font-family: monospace, monospace;
        padding: 1px 3px;
        font-size: 0.92rem;
        color: #e96900;
        background-color: #f8f8f8;
        border-radius: 2px;
    }

    #vcomments pre code {
        font-family: monospace, monospace;
        padding: 0;
        color: #e8eaf6;
        background-color: #272822;
    }

    #vcomments pre[class*="language-"] {
        padding: 1.2em;
        margin: .5em 0;
    }

    #vcomments code[class*="language-"],
    pre[class*="language-"] {
        color: #e8eaf6;
    }

    #vcomments [type="checkbox"]:not(:checked), [type="checkbox"]:checked {
        position: inherit;
        margin-left: -1.3rem;
        margin-right: 0.4rem;
        margin-top: -1px;
        vertical-align: middle;
        left: unset;
        visibility: visible;
    }

    #vcomments b,
    strong {
        font-weight: bold;
    }

    #vcomments dfn {
        font-style: italic;
    }

    #vcomments small {
        font-size: 85%;
    }

    #vcomments cite {
        font-style: normal;
    }

    #vcomments mark {
        background-color: #fcf8e3;
        padding: .2em;
    }

    #vcomments table, th, td {
        padding: 12px 13px;
        border: 1px solid #dfe2e5;
    }

    table tr:nth-child(2n), thead {
        background-color: #fafafa;
    }

    #vcomments table th {
        background-color: #f2f2f2;
        min-width: 80px;
    }

    #vcomments table td {
        min-width: 80px;
    }

    #vcomments [type="checkbox"]:not(:checked), [type="checkbox"]:checked {
        position: inherit;
        margin-left: -1.3rem;
        margin-right: 0.4rem;
        margin-top: -1px;
        vertical-align: middle;
        left: unset;
        visibility: visible;
    }
</style>

<div class="card valine-card" data-aos="fade-up">
    <div class="comment_headling" style="font-size: 20px; font-weight: 700; position: relative; padding-left: 20px; top: 15px; padding-bottom: 5px;">
        <i class="fas fa-comments fa-fw" aria-hidden="true"></i>
        <span>评论</span>
    </div>
    <div id="vcomments" class="card-content" style="display: grid">
    </div>
</div>

<script src="/libs/valine/av-min.js"></script>
<script src="/libs/valine/Valine.min.js"></script>
<script>
    new Valine({
        el: '#vcomments',
        appId: 'iHpJ1K3Qtp3WD6zj6lvHdXc6-MdYXbMMI',
        appKey: 'cbmLFjH9FaWQUdIVOSILOr1s',
        notify: 'true' === 'true',
        verify: 'true' === 'true',
        visitor: 'true' === 'true',
        avatar: 'monsterid',
        pageSize: '10',
        lang: 'zh-cn',
        placeholder: '来，快夸我，快'
    });
</script>

<!--酷Q推送-->


    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/2021/09/01/javaweb/session/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/10.jpg" class="responsive-img" alt="Session">
                        
                        <span class="card-title">Session</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2021-09-01
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/%E5%90%8E%E7%AB%AF/" class="post-category">
                                    后端
                                </a>
                            
                            <a href="/categories/java/" class="post-category">
                                    java
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/session/">
                        <span class="chip bg-color">session</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2021/08/31/database/oraclereview/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/17.jpg" class="responsive-img" alt="Oracle复习">
                        
                        <span class="card-title">Oracle复习</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2021-08-31
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/" class="post-category">
                                    数据库
                                </a>
                            
                            <a href="/categories/%E5%90%8E%E7%AB%AF/" class="post-category">
                                    后端
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/Oracle/">
                        <span class="chip bg-color">Oracle</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>


<script>
    $('#articleContent').on('copy', function (e) {
        // IE8 or earlier browser is 'undefined'
        if (typeof window.getSelection === 'undefined') return;

        var selection = window.getSelection();
        // if the selection is short let's not annoy our users.
        if (('' + selection).length < Number.parseInt('120')) {
            return;
        }

        // create a div outside of the visible area and fill it with the selected text.
        var bodyElement = document.getElementsByTagName('body')[0];
        var newdiv = document.createElement('div');
        newdiv.style.position = 'absolute';
        newdiv.style.left = '-99999px';
        bodyElement.appendChild(newdiv);
        newdiv.appendChild(selection.getRangeAt(0).cloneContents());

        // we need a <pre> tag workaround.
        // otherwise the text inside "pre" loses all the line breaks!
        if (selection.getRangeAt(0).commonAncestorContainer.nodeName === 'PRE' || selection.getRangeAt(0).commonAncestorContainer.nodeName === 'CODE') {
            newdiv.innerHTML = "<pre>" + newdiv.innerHTML + "</pre>";
        }

        var url = document.location.href;
        newdiv.innerHTML += '<br />'
            + '来源: 张小菜<br />'
            + '文章作者: 张小菜<br />'
            + '文章链接: <a href="' + url + '">' + url + '</a><br />'
            + '本文章著作权归作者所有，任何形式的转载都请注明出处。';

        selection.selectAllChildren(newdiv);
        window.setTimeout(function () {bodyElement.removeChild(newdiv);}, 200);
    });
</script>


<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget card" style="background-color:rgba(255,255,255,0.5);">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">

    

    

    <div class="container row center-align"
         style="margin-bottom: 15px !important;">
        <div class="col s12 m8 l8 copy-right" style="color: black;font-size: 13px;">
            Copyright&nbsp;&copy;
            
                <span id="year" style="color: black">2021-2023</span>
            
            <!--<span id="year" style="color: black">2021</span>-->
            <a href="/about" target="_blank" style="color: orangered">张小菜</a>
            版权所有
            |&nbsp;Powered by&nbsp;<span style="color: orangered" target="_blank">H</span>
            |&nbsp;公安备案&nbsp;<span style="color: orangered" target="_blank">当中...</span>
            <br>
            <!--计算总字数-->
                &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                        class="white-color" style="color: orangered;">39.3k</span>
            
            
            
                
            
            <!--显示总访问量-->
                <span id="busuanzi_container_site_pv">
                &nbsp;|&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;
                    <span id="busuanzi_value_site_pv" class="white-color" style="color: orangered;"></span>
            </span>
            
            
                <span id="busuanzi_container_site_uv">
                &nbsp;|&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;
                    <span id="busuanzi_value_site_uv" class="white-color" style="color: orangered;"></span><!--总访问人数-->
            </span>
            
            <br>

            <!-- 运行天数提醒. -->
            
                <span id="sitetime"> Loading ...</span>
                <!--<script>
                    var calcSiteTime = function () {
                        var seconds = 1000;
                        var minutes = seconds * 60;
                        var hours = minutes * 60;
                        var days = hours * 24;
                        var years = days * 365;
                        var today = new Date();
                        var startYear = "2021";
                        var startMonth = "8";
                        var startDate = "1";
                        var startHour = "0";
                        var startMinute = "0";
                        var startSecond = "0";
                        var todayYear = today.getFullYear();
                        var todayMonth = today.getMonth() + 1;
                        var todayDate = today.getDate();
                        var todayHour = today.getHours();
                        var todayMinute = today.getMinutes();
                        var todaySecond = today.getSeconds();
                        var t1 = Date.UTC(startYear, startMonth, startDate, startHour, startMinute, startSecond);
                        var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
                        var diff = t2 - t1;
                        var diffYears = Math.floor(diff / years);
                        var diffDays = Math.floor((diff / days) - diffYears * 365);

                        // 区分是否有年份.
                        var language = 'zh-CN';
                        if (startYear === String(todayYear)) {
                            document.getElementById("year").innerHTML = todayYear;
                            var daysTip = 'This site has been running for ' + diffDays + ' days';
                            if (language === 'zh-CN') {
                                daysTip = '本站已运行 ' + diffDays + ' 天';
                            } else if (language === 'zh-HK') {
                                daysTip = '本站已運行 ' + diffDays + ' 天';
                            }
                            document.getElementById("sitetime").innerHTML = daysTip;
                        } else {
                            document.getElementById("year").innerHTML = startYear + " - " + todayYear;
                            var yearsAndDaysTip = 'This site has been running for ' + diffYears + ' years and '
                                + diffDays + ' days';
                            if (language === 'zh-CN') {
                                yearsAndDaysTip = '本站已运行 ' + diffYears + ' 年 ' + diffDays + ' 天';
                            } else if (language === 'zh-HK') {
                                yearsAndDaysTip = '本站已運行 ' + diffYears + ' 年 ' + diffDays + ' 天';
                            }
                            document.getElementById("sitetime").innerHTML = yearsAndDaysTip;
                        }
                    }

                    calcSiteTime();
                </script>-->
                <script language=javascript>
                  function siteTime() {
                    window.setTimeout("siteTime()", 1000);
                    var seconds = 1000;
                    var minutes = seconds * 60;
                    var hours = minutes * 60;
                    var days = hours * 24;
                    var years = days * 365;
                    var today = new Date();
                    var todayYear = today.getFullYear();
                    var todayMonth = today.getMonth() + 1;
                    var todayDate = today.getDate();
                    var todayHour = today.getHours();
                    var todayMinute = today.getMinutes();
                    var todaySecond = today.getSeconds();
                    /* Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
                    year - 作为date对象的年份，为4位年份值
                    month - 0-11之间的整数，做为date对象的月份
                    day - 1-31之间的整数，做为date对象的天数
                    hours - 0(午夜24点)-23之间的整数，做为date对象的小时数
                    minutes - 0-59之间的整数，做为date对象的分钟数
                    seconds - 0-59之间的整数，做为date对象的秒数
                    microseconds - 0-999之间的整数，做为date对象的毫秒数 */
                    var t1 = Date.UTC('2021',
                            "8",
                            "1",
                            "0",
                            "0",
                            "0"); //北京时间2018-2-13 00:00:00
                    var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
                    var diff = t2 - t1;
                    var diffYears = Math.floor(diff / years);
                    var diffDays = Math.floor((diff / days) - diffYears * 365);
                    var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours);
                    var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) / minutes);
                    var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours - diffMinutes * minutes) / seconds);
                    document.getElementById("sitetime").innerHTML = "本站已运行 " +diffYears+" 年 "+diffDays + " 天 " + diffHours + " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                  }/*因为建站时间还没有一年，就将之注释掉了。需要的可以取消*/
                  siteTime();
                </script>
            
            <br>
            
                <span id="icp"><img src="/medias/icp.png"
                                    style="vertical-align: text-bottom;"/>
                <a href="http://beian.miit.gov.cn/" target="_blank" style="color: black">湘ICP备2021014506号-1</a>
            </span>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/ZhangXiaoCaiNB" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github" style="color: #00C853;"></i>
    </a>



    <a href="mailto:3292534860@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>



    <a href="https://www.facebook.com/profile.php?id=100066270737195" class="tooltipped" target="_blank" data-tooltip="关注我的Facebook: https://www.facebook.com/profile.php?id=100066270737195" data-position="top" data-delay="50">
        <i class="fab fa-facebook-f" style="color: hotpink"></i>
    </a>



    <a href="https://twitter.com/v6gbBoT36uWweWA" class="tooltipped" target="_blank" data-tooltip="关注我的Twitter: https://twitter.com/v6gbBoT36uWweWA" data-position="top" data-delay="50">
        <i class="fab fa-twitter" style="color: #c6ff00"></i>
    </a>



    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=3292534860" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 3292534860" data-position="top" data-delay="50">
        <i class="fab fa-qq" style="color: #00b0ff;"></i>
    </a>







</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script type="text/javascript">
$(function () {
    var searchFunc = function (path, search_id, content_id) {
        'use strict';
        $.ajax({
            url: path,
            dataType: "xml",
            success: function (xmlResponse) {
                // get the contents from search data
                var datas = $("entry", xmlResponse).map(function () {
                    return {
                        title: $("title", this).text(),
                        content: $("content", this).text(),
                        url: $("url", this).text()
                    };
                }).get();
                var $input = document.getElementById(search_id);
                var $resultContent = document.getElementById(content_id);
                $input.addEventListener('input', function () {
                    var str = '<ul class=\"search-result-list\">';
                    var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                    $resultContent.innerHTML = "";
                    if (this.value.trim().length <= 0) {
                        return;
                    }
                    // perform local searching
                    datas.forEach(function (data) {
                        var isMatch = true;
                        var data_title = data.title.trim().toLowerCase();
                        var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                        var data_url = data.url;
                        data_url = data_url.indexOf('/') === 0 ? data.url : '/' + data_url;
                        var index_title = -1;
                        var index_content = -1;
                        var first_occur = -1;
                        // only match artiles with not empty titles and contents
                        if (data_title !== '' && data_content !== '') {
                            keywords.forEach(function (keyword, i) {
                                index_title = data_title.indexOf(keyword);
                                index_content = data_content.indexOf(keyword);
                                if (index_title < 0 && index_content < 0) {
                                    isMatch = false;
                                } else {
                                    if (index_content < 0) {
                                        index_content = 0;
                                    }
                                    if (i === 0) {
                                        first_occur = index_content;
                                    }
                                }
                            });
                        }
                        // show search results
                        if (isMatch) {
                            str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                            var content = data.content.trim().replace(/<[^>]+>/g, "");
                            if (first_occur >= 0) {
                                // cut out 100 characters
                                var start = first_occur - 20;
                                var end = first_occur + 80;
                                if (start < 0) {
                                    start = 0;
                                }
                                if (start === 0) {
                                    end = 100;
                                }
                                if (end > content.length) {
                                    end = content.length;
                                }
                                var match_content = content.substr(start, end);
                                // highlight all keywords
                                keywords.forEach(function (keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>");
                                });

                                str += "<p class=\"search-result\">" + match_content + "...</p>"
                            }
                            str += "</li>";
                        }
                    });
                    str += "</ul>";
                    $resultContent.innerHTML = str;
                });
            }
        });
    };

    searchFunc('/search.xml', 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    <!--腾讯兔小巢-->
    
    

    
    
    <script type="text/javascript" size="150" alpha='0.6'
        zIndex="-1" src="/libs/background/ribbon.min.js" async="async"></script>
    

    
    <script type="text/javascript" src="/libs/background/ribbon-dynamic.js" async="async"></script>
    

    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

    

    <!--title标签变换文字块-->
    <script type="text/javascript">
      var OriginTitile = document.title,
          st;
      document.addEventListener("visibilitychange", function () {
        document.hidden ? (document.title = "看不见我🙈~看不见我🙈~", clearTimeout(st)) : (document.title =
            "(๑•̀ㅂ•́) ✧被发现了～", st = setTimeout(function () {
          document.title = OriginTitile
        }, 3e3))
      })
    </script>

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"log":false,"model":{"jsonPath":"/live2dw/assets/hijiki.model.json"},"display":{"position":"left","width":70,"height":140},"mobile":{"show":true},"react":{"opacity":0.7}});</script></body>

</html>
